﻿<%@ Page Language="C#" EnableEventValidation="false"  MasterPageFile="~/Design/MasterPage/MasterPage.master" AutoEventWireup="true" CodeFile="MessageUpdForm.aspx.cs" Inherits="App_Input_MessageUpdForm"  Title="个人待办"%>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<script type="text/javascript" >
function addEmps()
{
//var s="1,2,3,4".split(',');
//alert(s[2]);
 getEmps();
var cntId='<%=dropToEmp.ClientID%>';
var strEmps=window.document.getElementById('<%=hidEmps.ClientID %>').value;

window.open('../Commons/EmployeesSearchForm.aspx?CONTROL_ID='+cntId+"&EMPS="+strEmps,'EmployeesSearchForm','scrollbars,resizable');

}


function delEmps()
{
    var emps = window.document.getElementById('<%=dropToEmp.ClientID %>');
    if(emps.length<=0 || emps.selectedIndex <0)
    {
        alert("请选择删除对象");
        return;
    }
    
    
    delSelectEmps(emps);
    initEmps();
}


function delSelectEmps(emps)
{
if(emps.selectedIndex<0)
{
return;
}
emps.remove(emps.selectedIndex);
delSelectEmps(emps);
}


function getEmps()
{
 var emps = window.document.getElementById('<%=dropToEmp.ClientID %>');
 var strEmps="";
  for(var i=0; i<emps.length; i++)
    {

        if(strEmps == null || strEmps == "")
        {
           strEmps= emps.options[i].value;
        }
        else
        {
            strEmps = strEmps+","+emps.options[i].value;
        }

    }
    window.document.getElementById('<%=hidEmps.ClientID %>').value=strEmps;
}

function initEmps()
{
 var emps = window.document.getElementById('<%=dropToEmp.ClientID %>');
 var strEmps="";
  for(var i=0; i<emps.length; i++)
    {

        if(strEmps == null || strEmps == "")
        {
           strEmps= emps.options[i].value+","+emps.options[i].text;
        }
        else
        {
            strEmps = strEmps+","+emps.options[i].value+","+emps.options[i].text;
        }

    }
    window.document.getElementById('<%=hidEmps.ClientID %>').value=strEmps;
}
</script>
    <div>
        <table width="100%">
            <tr>
                <td colspan="4">
                    <table class="table_border_line">
                        <tr>
                            <td align="left" colspan="6">

                                <script language="javascript">
                                        (new TitleBar('SearchBar', '待办消息')).showBar();
                                </script>

                            </td>
                        </tr>
                    </table>
                </td>
                <td colspan="1">
                </td>
            </tr>
            <tr>
                <td style="width: 113px; height: 37px">
                
                </td>
                <td style="width: 125px; height: 37px;">
                标题
                </td>
                <td style="height: 37px; width: 355px;">
                    <asp:TextBox ID="txtSubject" runat="server" Width="336px"></asp:TextBox>
                </td>
                <td style="height: 37px">
                </td>
            </tr>
            <tr>
                <td style="width: 113px; height: 123px;" align="right">
                    <span style="color: #ff7300">*</span></td>
                <td style="width: 125px; height: 123px;">
                内容
                </td>
                <td style="width: 355px; height: 123px;">
                    <asp:TextBox ID="txtMessage" runat="server" TextMode="MultiLine" Height="117px" Width="336px" ></asp:TextBox>
                </td>
                <td style="height: 123px">
                </td>
            </tr>
           

             <tr>
              <td style="width: 113px; height: 143px;" align="right" >
                  <span style="color: #ff7300">*</span></td>
                 <td style="width: 125px; height: 143px;">
                     发送对象
                </td>
                <td style="width: 355px; height: 143px">
                    <asp:ListBox ID="dropToEmp"  runat="server" Height="123px" Width="336px" SelectionMode="Multiple">
                    </asp:ListBox>
                 </td>
                 <td  style="height: 143px">
                 
                      <table>
                 <tr>
                    <td style="width: 56px">
                    <input id="btnAdd" type="button" value="添 加"  onclick="addEmps()"  runat="server" />
                    
                    </td>
                 </tr>
                 <tr>
                    <td style="height: 42px; width: 56px;">
                    <input id="btnDel" type="button" value="删 除"  onclick="delEmps()" runat="server"/>
                    </td>
                 </tr>
                 </table>
                 </td>
            </tr>
             <tr>
                <td style="width: 113px; height: 39px;">
                </td>
                <td style="width: 125px; height: 39px;" valign="middle">
                    消息状态</td>
                <td style="width: 355px; height: 39px;" valign="middle">
                    <asp:CheckBoxList ID="chkMessageStatus" runat="server" 
                        RepeatDirection="Horizontal">
                        <asp:ListItem Value="01">必须回复</asp:ListItem>
                        <asp:ListItem Value="02">加急</asp:ListItem>
                        <asp:ListItem Value="03">阅读履历</asp:ListItem>
                    </asp:CheckBoxList></td>
                <td style="height: 39px">
                </td>
            </tr>
            <tr>
                <td style="width: 113px; height: 41px">
                </td>
                <td align="center" colspan="2" style="height: 41px">
                    <asp:Button ID="btnSend" runat="server" Text="发 送" Width="86px" CssClass="button" OnClick="btnSend_Click"  OnClientClick="initEmps()"/>
                    &nbsp;&nbsp; &nbsp;<input type="button" id="btnClose" value="关 闭" class="button" onclick="window.close();" style="width: 86px"/>
                    &nbsp; &nbsp;</td>
                <td align="center" colspan="1" style="height: 41px">
                </td>
            </tr>
        </table>
                
    </div>
    <asp:HiddenField ID="hidEmps" runat="server" />
</asp:Content> 
